/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.							  */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib.  */
/*----------------------------------------------------------------------------*/
#ifndef ANALOG_TRIGGER_H_
#define ANALOG_TRIGGER_H_

#include "ChipObject.h"
#include "AnalogChannel.h"
#include "AnalogTriggerOutput.h"

class AnalogTrigger: public SensorBase
{
	friend class AnalogTriggerOutput;
public:
	AnalogTrigger(unsigned slot, unsigned channel);
	AnalogTrigger(unsigned channel);
	AnalogTrigger(AnalogChannel *channel);
	virtual ~AnalogTrigger(void);

	void SetLimitsVoltage(float lower, float upper);
	void SetLimitsRaw(signed int lower, signed int upper);
	void SetAveraged(bool useAveragedValue);
	void SetFiltered(bool useFilteredValue);
	unsigned GetIndex(void);
	bool GetInWindow(void);
	bool GetTriggerState(void);
	AnalogTriggerOutput *CreateOutput(AnalogTriggerOutput::Type type);

private:
	void InitTrigger(unsigned slot, unsigned channel);

	unsigned char m_index;
	tAnalogTrigger *m_trigger;
	AnalogModule *m_analogModule;
	unsigned m_channel;
};

#endif

